import Vue from 'vue'
//import Element from 'element-ui'
/* import enLocale from 'element-ui/lib/locale/lang/en'
import zhLocale from 'element-ui/lib/locale/lang/zh-CN'
import twLocale from 'element-ui/lib/locale/lang/zh-TW'
import kolocale from 'element-ui/lib/locale/lang/ko'
import jaLocale from 'element-ui/lib/locale/lang/ja'
import ptlocale from 'element-ui/lib/locale/lang/pt'
import esLocale from 'element-ui/lib/locale/lang/es'
import delocale from 'element-ui/lib/locale/lang/de'
import frLocale from 'element-ui/lib/locale/lang/fr'
import swlocale from 'element-ui/lib/locale/lang/sw'
import vilocale from 'element-ui/lib/locale/lang/vi'
Vue.use(Element, { enLocale, zhLocale }) */

//Vue.use(Element)

import {
  Button,
  ButtonGroup,
  Empty,
  Divider,
  Form,
  FormItem,
  Input,
  Row,
  Col,
  Loading,
  Message,
  Checkbox,
  CheckboxButton,
  CheckboxGroup,
  Radio,
  RadioGroup,
  RadioButton,
  Popover,
  InputNumber,
  Select,
  Scrollbar,
  Image,
  Table,
  TableColumn,
  Progress,
  Dialog,
  Tooltip,
  Pagination,
  Skeleton,
  SkeletonItem,
  Tree,
  Option,
  Tabs,
  TabPane,
  Rate
} from 'element-ui'

let messageInstance = null
const resetMessage = (options) => {
  if (messageInstance) {
    messageInstance.close()
  }
  messageInstance = Message(options)
}
;['error', 'success', 'info', 'warning'].forEach((type) => {
  resetMessage[type] = (options) => {
    if (typeof options === 'string') {
      options = {
        message: options,
      }
    }
    options.type = type
    return resetMessage(options)
  }
})

Vue.use(Loading.directive)
Vue.prototype.$loading = Loading.service
Vue.prototype.$message = resetMessage

Vue.use(ButtonGroup)
Vue.use(Button)
Vue.use(Empty)
Vue.use(Divider)
Vue.use(Form)
Vue.use(FormItem)
Vue.use(Input)
Vue.use(Row)
Vue.use(Col)
Vue.use(Checkbox)
Vue.use(CheckboxButton)
Vue.use(CheckboxGroup)
Vue.use(Popover)
Vue.use(InputNumber)
Vue.use(Radio)
Vue.use(RadioGroup)
Vue.use(RadioButton)
Vue.use(Select)
Vue.use(Scrollbar)
Vue.use(Image)
Vue.use(Table)
Vue.use(TableColumn)
Vue.use(Progress)
Vue.use(Dialog)
Vue.use(Tooltip)
Vue.use(Pagination)
Vue.use(Skeleton)
Vue.use(SkeletonItem)
Vue.use(Tree)
Vue.use(Option)
Vue.use(Tabs)
Vue.use(TabPane)
Vue.use(Rate)
